package edu.colorado;

import edu.colorado.core.Game;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;

public class NewGameActivity extends Activity implements OnClickListener {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.new_game);
        
        View easy = findViewById(R.id.easyButton);
        View medium = findViewById(R.id.mediumButton);
        View hard = findViewById(R.id.hardButton);
        
        easy.setOnClickListener(this);
        medium.setOnClickListener(this);
        hard.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        Intent game = new Intent(this, GameActivity.class);
        game.putExtra(GameActivity.MODE, Game.Mode.Game);
        
        switch (v.getId()) {
        case R.id.easyButton:
            game.putExtra(GameActivity.LEVEL, Game.Level.Easy);
            break;
        case R.id.mediumButton:
            game.putExtra(GameActivity.LEVEL, Game.Level.Medium);
            break;
        case R.id.hardButton:
            game.putExtra(GameActivity.LEVEL, Game.Level.Hard);
            break;
        }
        
        startActivity(game);
    }
}